/**
 * 
 */
package com.cqcis.uip.module.salary.oper.dao;

import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;

import com.cqcis.uip.base.framework.utils.JdbcUtil;
import com.cqcis.uip.module.salary.oper.SalaryConstants;
import com.cqcis.uip.module.salary.oper.domain.SalaryCourseTimesDetail;

/**
 * @author 李世军
 *
 * 创建于 2012-3-20 下午02:48:01
 */
public class SalaryCourseTimesDetailDao extends SimpleJdbcDaoSupport {
	private static String INSERT_SQL = " insert into financecontrol_salarycoursetimesdetail(company_id,student_id,grade_id,employe_id,do_time,begin_time,end_time,course_id,study_type,course_times,student_manager_id,price,ratio,fee,student_manager_fee,month,remark) "
		+ " values(:company_id,:student_id,:grade_id,:employe_id,:do_time,:begin_time,:end_time,:course_id,:study_type,:course_times,:student_manager_id,:price,:ratio,:fee,:student_manager_fee,:month,:remark) ";

	private static String DELETE_SQL = " delete from financecontrol_salarycoursetimesdetail where month>=? and month<=?   ";
	
	/**
	 * 保存
	 * 
	 * @param salaryMain
	 */
	public void insert(SalaryCourseTimesDetail detail) {
		detail.setMonth(SalaryConstants.SALARY_GENERATE_DATE);
		JdbcUtil.update(INSERT_SQL, detail, this);
	}
	
	/**
	 * 删除当月数据
	 */
	public void delete() {
		JdbcUtil.update(this, DELETE_SQL, SalaryConstants.SALARY_BEGIN_DATE, SalaryConstants.SALARY_END_DATE);
	}
}
